package org.datastructure;

public class MyDemo {
    public static void main(String[] args) {
        String str = "this is a boy";
        String[] s = str.split(" ");

       String strTo="";
        for (int i = s.length - 1; i >= 0; i--) {
            for (int j = 0; j < s[i].length(); j++) {
                if (j == 0) {
                    strTo+=(s[i].charAt(j)+"").toUpperCase();
                }else{
                    strTo+=s[i].charAt(j);
                }
            }
            strTo+=" ";
        }
        System.out.println(strTo);
    }
}
